<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD><TITLE>Load manual page - Tcl Library Procedures</TITLE>
<link rel="stylesheet" href="../docs.css" type="text/css" media="all">
</HEAD>
<BODY><H2><a href="../contents.htm">Tcl8.6.11/Tk8.6.11 Documentation</a> <small>&gt;</small> <a href="contents.htm">Tcl C API</a> <small>&gt;</small> Load</H2>
<H3><A HREF="../UserCmd/contents.htm">Tcl/Tk Applications</A> | <A HREF="../TclCmd/contents.htm">Tcl Commands</A> | <A HREF="../TkCmd/contents.htm">Tk Commands</A> | <A HREF="../ItclCmd/contents.htm">[incr Tcl] Package Commands</A> | <A HREF="../SqliteCmd/contents.htm">SQLite3 Package Commands</A> | <A HREF="../TdbcCmd/contents.htm">TDBC Package Commands</A> | <A HREF="../TdbcmysqlCmd/contents.htm">tdbc::mysql Package Commands</A> | <A HREF="../TdbcodbcCmd/contents.htm">tdbc::odbc Package Commands</A> | <A HREF="../TdbcpostgresCmd/contents.htm">tdbc::postgres Package Commands</A> | <A HREF="../TdbcsqliteCmd/contents.htm">tdbc::sqlite3 Package Commands</A> | <A HREF="../ThreadCmd/contents.htm">Thread Package Commands</A> | <A HREF="../TclLib/contents.htm">Tcl C API</A> | <A HREF="../TkLib/contents.htm">Tk C API</A> | <A HREF="../ItclLib/contents.htm">[incr Tcl] Package C API</A> | <A HREF="../TdbcLib/contents.htm">TDBC Package C API</A></H3>
<DL>
<DD><A HREF="Load.htm#M2" NAME="L470">NAME</A>
<DL><DD>Tcl_LoadFile, Tcl_FindSymbol &mdash; platform-independent dynamic library loading</DD></DL>
<DD><A HREF="Load.htm#M3" NAME="L471">SYNOPSIS</A>
<DL>
<DD><B>#include &lt;tcl.h&gt;</B>
<DD>int
<DD><B>Tcl_LoadFile</B>(<I>interp, pathPtr, symbols, flags, procPtrs, loadHandlePtr</I>)
<DD>void *
<DD><B>Tcl_FindSymbol</B>(<I>interp, loadHandle, symbol</I>)
</DL>
<DD><A HREF="Load.htm#M4" NAME="L472">ARGUMENTS</A>
<DL class="arguments">
</DL>
<DD><A HREF="Load.htm#M5" NAME="L473">DESCRIPTION</A>
<DD><A HREF="Load.htm#M6" NAME="L474">SEE ALSO</A>
<DD><A HREF="Load.htm#M7" NAME="L475">KEYWORDS</A>
</DL>
<H3><A NAME="M2">NAME</A></H3>
Tcl_LoadFile, Tcl_FindSymbol &mdash; platform-independent dynamic library loading
<H3><A NAME="M3">SYNOPSIS</A></H3>
<B>#include &lt;tcl.h&gt;</B><BR>
int<BR>
<B>Tcl_LoadFile</B>(<I>interp, pathPtr, symbols, flags, procPtrs, loadHandlePtr</I>)<BR>
void *<BR>
<B>Tcl_FindSymbol</B>(<I>interp, loadHandle, symbol</I>)<BR>
<H3><A NAME="M4">ARGUMENTS</A></H3>
<DL class="arguments">
<DT><A HREF="../TclLib/Interp.htm">Tcl_Interp</A> <B>*interp</B> (in)<DD>
Interpreter to use for reporting error messages.
<P><DT><A HREF="../TclLib/Object.htm">Tcl_Obj</A> <B>*pathPtr</B> (in)<DD>
The name of the file to load. If it is a single name, the library search path
of the current environment will be used to resolve it.
<P><DT>const char *const <B>symbols[]</B> (in)<DD>
Array of names of symbols to be resolved during the load of the library, or
NULL if no symbols are to be resolved. If an array is given, the last entry in
the array must be NULL.
<P><DT>int <B>flags</B> (in)<DD>
The value should normally be 0, but <I>TCL_LOAD_GLOBAL</I> or <I>TCL_LOAD_LAZY</I>
or a combination of those two is allowed as well.
<P><DT>void <B>*procPtrs</B> (out)<DD>
Points to an array that will hold the addresses of the functions described in
the <I>symbols</I> argument. Should be NULL if no symbols are to be resolved.
<P><DT>Tcl_LoadHandle <B>*loadHandlePtr</B> (out)<DD>
Points to a variable that will hold the handle to the abstract token
describing the library that has been loaded.
<P><DT>Tcl_LoadHandle <B>loadHandle</B> (in)<DD>
Abstract token describing the library to look up a symbol in.
<P><DT>const char <B>*symbol</B> (in)<DD>
The name of the symbol to look up.
<P></DL>
<H3><A NAME="M5">DESCRIPTION</A></H3>
<B>Tcl_LoadFile</B> loads a file from the filesystem (including potentially any
virtual filesystem that has been installed) and provides a handle to it that
may be used in further operations. The <I>symbols</I> array, if non-NULL,
supplies a set of names of symbols (typically functions) that must be resolved
from the library and which will be stored in the array indicated by
<I>procPtrs</I>. If any of the symbols is not resolved, the loading of the file
will fail with an error message left in the interpreter (if that is non-NULL).
The result of <B>Tcl_LoadFile</B> is a standard Tcl error code. The library may
be unloaded with <B><A HREF="../TclLib/FileSystem.htm">Tcl_FSUnloadFile</A></B>.
<P>
<B>Tcl_FindSymbol</B> locates a symbol in a loaded library and returns it. If
the symbol cannot be found, it returns NULL and sets an error message in the
given <I>interp</I> (if that is non-NULL). Note that it is unsafe to use this
operation on a handle that has been passed to <B><A HREF="../TclLib/FileSystem.htm">Tcl_FSUnloadFile</A></B>.
<H3><A NAME="M6">SEE ALSO</A></H3>
<B><A HREF="../TclLib/FileSystem.htm">Tcl_FSLoadFile</A></B>, <B><A HREF="../TclLib/FileSystem.htm">Tcl_FSUnloadFile</A></B>, <B><A HREF="../TclCmd/load.htm">load</A></B>, <B><A HREF="../TclCmd/unload.htm">unload</A></B>
<H3><A NAME="M7">KEYWORDS</A></H3>
<A href="../Keywords/B.htm#binary code">binary code</A>, <A href="../Keywords/L.htm#loading">loading</A>, <A href="../Keywords/S.htm#shared library">shared library</A>
<div class="copy">Copyright &copy; 2009-2010 Kevin B. Kenny
<BR>Copyright &copy; 2010 Donal K. Fellows
</div>
</BODY></HTML>
